'use strict';

import * as types from '../Commom/ActionConst';

const initialState = {
  dataFromBack: null,
}

// export default function refreshWithBack(state = initialState, action) {
//   // console.log('BackRefreshReducer',action);
//   switch (action.type) {
//     case types.REFRESH_WITH_BACK: 
//       return Object.assign({}, state, {
//         dataFromBack: action.dataFromBack,
//       });
//     case types.REFRESH_WITH_CLEAR: 
//       return Object.assign({}, state, {
//         dataFromBack: action.dataFromBack,
//       });
//     default:
//       return state;
//   }
// }
export default function refreshWithBack(state = initialState, action) {
  // console.log('BackRefreshReducer',action);
  switch (action.type) {
    case types.REFRESH_WITH_BACK: 
      return {
        ...state,
        dataFromBack: action.dataFromBack,
      };
    case types.REFRESH_WITH_CLEAR: 
      return {
        ...state,
        dataFromBack: action.dataFromBack,
      };
    default:
      return state;
  }
}